//
//  ViewController.m
//  DGChartDraw
//
//  Created by yidong on 16/11/4.
//  Copyright © 2016年 东哥. All rights reserved.
//

#import "ViewController.h"
#import "DGCirculardiagramViewController.h"
#import "DGPiechartViewController.h"
#import "DGColumnChartViewController.h"
#import "DGLineChartViewController.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation ViewController
{
    NSArray *array;
}
- (void)viewDidLoad {
    
    [super viewDidLoad];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    array = @[@"折线图",@"曲线图",@"环形图",@"扇形图",@"柱形图"];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
#pragma mark --- 代理
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return array.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *_indetity = @"cellID";
    
    UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:_indetity];
    
    if (!cell) {
        
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:_indetity];
        
        //cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        
    }
    cell.textLabel.text = array[indexPath.row];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *title = array[indexPath.row];
    
    if ([title isEqualToString:@"环形图"]) {
        DGCirculardiagramViewController *vc = [[DGCirculardiagramViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
    if ([title isEqualToString:@"扇形图"]) {
        DGPiechartViewController *vc = [[DGPiechartViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
    if ([title isEqualToString:@"柱形图"]) {
        DGColumnChartViewController *vc = [[DGColumnChartViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
    if ([title isEqualToString:@"折线图"]) {
         DGLineChartViewController *vc = [[ DGLineChartViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
    if ([title isEqualToString:@"曲线图"]) {
         DGLineChartViewController *vc = [[ DGLineChartViewController alloc] init];
        vc.iscurePath = YES;
        [self.navigationController pushViewController:vc animated:YES];
    }
   

}

@end
